/// Author: QP
/// Version: 1.0
/// Date:2021/07
/// 互联互通文档头主表
/// 
Class HCC.SQL.Document.Header Extends (%Persistent, %XML.Adaptor, HCC.SQL.Base) [ CompileAfter = (HCC.SQL.Base, HCC.SQL.Document.Header.Activity, HCC.SQL.Document.Header.RecordTarget, HCC.SQL.Document.Header.Custodian, HCC.SQL.Document.Header.Author, HCC.SQL.Document.Header.EncompassingEncounter) ]
{

/// 文档编号 (同时作为Idkey)
Property DocumentNo As %String(XMLPROJECTION = "NONE");

Index IdDocNo On DocumentNo [ IdKey, Unique ];

/// 文档活动类
Property activity As HCC.SQL.Document.Header.Activity [ SqlFieldName = act ];

/// 文档记录对象或健康保健对象
Property recordTarget As HCC.SQL.Document.Header.RecordTarget [ SqlFieldName = recTgt ];

/// 文档管理机构信息
Property custodian As HCC.SQL.Document.Header.Custodian [ SqlFieldName = cstn ];

/// 文档创作者
Property author As HCC.SQL.Document.Header.Author [ SqlFieldName = auth ];

/// 医生签名信息，法定审核者条目子表
Relationship Authenticators As HCC.SQL.Document.Header.Authenticator [ Cardinality = children, Inverse = DocumentNo ];

/// 医生签名信息，法定审核者条目子表
Relationship LegalAuthenticators As HCC.SQL.Document.Header.LegalAuthenticator [ Cardinality = children, Inverse = DocumentNo ];

/// 联系人条目子表
Relationship Participants As HCC.SQL.Document.Header.Participant [ Cardinality = children, Inverse = DocumentNo ];

/// 陈述者条目子表
Relationship Informants As HCC.SQL.Document.Header.Informant [ Cardinality = children, Inverse = DocumentNo ];

/// 关联活动条目子表
Relationship RelatedDocuments As HCC.SQL.Document.Header.RelatedDocument [ Cardinality = children, Inverse = DocumentNo ];

/// 就诊场景 
Property encompassingEncounter As HCC.SQL.Document.Header.EncompassingEncounter [ SqlFieldName = ecpsEnc ];

Property VisitType As %String;

/// 小结日期时间（仅用于文档C0043）
Property serviceEventTime As WS.DE.DE060021800 [ SqlFieldName = evtTime ];

Method SetEncounter(pDocNo)
{
    Set ..encompassingEncounter=##class(HCC.SQL.Document.Header.EncompassingEncounter).%OpenId(pDocNo)
}


}
